package com.singzi.testCase;

import java.util.ArrayList;
import java.util.List;

public class ListSum {
    public static void main(String[] args) {
        List<Integer> temp = new ArrayList<>();
        temp.add(5);

        int sum = temp.stream().mapToInt(x -> x).sum();
        System.out.println(sum);
        int []a = {1,2,3,45};
        System.out.println(a.length);
        System.out.println(sumList(temp));
    }
    public static int sumList(List<Integer> list){
        int n = list.size();
        int sum = 0;
        for(int i = 0;i < n;i++){
            sum += list.get(i);
        }
        return sum;

    }

}
